package biz.obake.team.touchprotector.d.i;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import biz.obake.team.touchprotector.g.c;
import java.util.Map;

public class b implements biz.obake.team.touchprotector.d.a {

    /* renamed from: b  reason: collision with root package name */
    private BroadcastReceiver f1582b = new a(this);

    class a extends BroadcastReceiver {
        a(b bVar) {
        }

        public void onReceive(Context context, Intent intent) {
            String str;
            String action = intent.getAction();
            if (action != null) {
                char c2 = 65535;
                int hashCode = action.hashCode();
                if (hashCode != -2128145023) {
                    if (hashCode == -1454123155 && action.equals("android.intent.action.SCREEN_ON")) {
                        c2 = 0;
                    }
                } else if (action.equals("android.intent.action.SCREEN_OFF")) {
                    c2 = 1;
                }
                if (c2 == 0) {
                    biz.obake.team.touchprotector.log.a.b().d("Screen: On");
                    str = "On";
                    if (str.equals(c.c("Screen.State"))) {
                        return;
                    }
                } else if (c2 == 1) {
                    biz.obake.team.touchprotector.log.a.b().d("Screen: Off");
                    str = "Off";
                    if (str.equals(c.c("Screen.State"))) {
                        return;
                    }
                } else {
                    return;
                }
                c.g("Screen.State", str);
            }
        }
    }

    public static void a(Map<String, String> map) {
        map.put("Screen.State", biz.obake.team.touchprotector.c.r() ? "On" : "Off");
    }

    public static boolean b() {
        boolean z = !biz.obake.team.touchprotector.c.r();
        String str = "Off";
        if (z != str.equals(c.c("Screen.State"))) {
            if (!z) {
                str = "On";
            }
            c.g("Screen.State", str);
        }
        return z;
    }

    public static boolean c() {
        boolean r = biz.obake.team.touchprotector.c.r();
        String str = "On";
        if (r != str.equals(c.c("Screen.State"))) {
            if (!r) {
                str = "Off";
            }
            c.g("Screen.State", str);
        }
        return r;
    }

    private void d() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.SCREEN_ON");
        intentFilter.addAction("android.intent.action.SCREEN_OFF");
        biz.obake.team.android.a.a().registerReceiver(this.f1582b, intentFilter);
    }

    private void e() {
        biz.obake.team.android.a.a().unregisterReceiver(this.f1582b);
    }

    public void start() {
        d();
    }

    public void stop() {
        e();
    }
}
